﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Xml;
using System.Globalization;
using System.Diagnostics;

namespace SkeletalAnimation3D.Core
{
	public class BoneAnimation
	{
        private string _name;

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }
        private Duration _duration;
        private BoneFrameCollection _frames = new BoneFrameCollection();

        public Duration Duration 
        { 
            get { return _duration; }
            set { _duration = value; }
        }

        public BoneFrameCollection Frames
        {
            get
            {
                return _frames;
            }
            set
            {
                _frames = value;
            }
        }

        public BoneAnimation()
        {
        }

        public BoneAnimation(string name, Duration duration)
        {
            _name = name;
            _duration = duration;
        }

        internal void FindSurroundingFrames(double offset, out BoneFrame preFrame, out BoneFrame postFrame)
        {
            preFrame = null;
            postFrame = null;
            for (int f = 1; f < Frames.Count; f++)
            {
                if (Frames[f].Offset >= offset)
                {
                    preFrame = Frames[f - 1];
                    postFrame = Frames[f];
                    break;
                }
            }
            
        }


    }
}
